<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>首页----惠济区管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="./layui/css/layui.css">
    <link rel="stylesheet" href="./layui/css/admin1.css">
    <link rel="shortcut icon" type="image/x-icon" href="./img/favicon.ico" />
    <script>
        window.shifoxuyaotianjiashuxing = true;
    </script>
    <style>
        .layadmin-tabs-select.layui-nav .layui-nav-child {
            left: -103px;
        }
        
        body {
            position: relative;
        }
        
        iframe {
            width: 100%;
            height: 100%;
        }
        
        .layui-side-menu .layui-nav .layui-nav-child .layui-nav-child a {
            padding-left: 60px;
        }
    </style>
    <script>
        // 跳转进入登陆页面
        function tianzhuanjinrulogin() {
            alert(1)
            window.location.href = "./html/denglu/index.html"
        }
    </script>
</head>
<style>
    .layui-side-menu .layui-nav .layui-nav-item a {
        height: 50px;
        line-height: 50px;
    }
    
    .layui-side-menu .layui-nav .layui-nav-item .layui-icon {
        top: 42%;
    }
</style>

<body class="layui-layout-body">

    <div id="LAY_app" class="me">
        <div class="layui-layout layui-layout-admin">
            <!-- 顶部 -->
            <div class="layui-header">
                <!-- 头部区域 -->
                <ul class="layui-nav layui-layout-left">
                    <li class="layui-nav-item layadmin-flexible shousuo" lay-unselect>
                        <a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
                            <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
                        </a>
                    </li>
                    <!-- <li class="layui-nav-item layui-hide-xs" lay-unselect>
                        <a href="#" target="_blank" title="前台">
                            <i class="layui-icon layui-icon-website"></i>
                        </a>
                    </li> -->
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;" id="refresh" layadmin-event="refresh" title="刷新">
                            <i class="layui-icon layui-icon-refresh-3"></i>
                        </a>
                    </li>
                    <!-- <li class="layui-nav-item layui-hide-xs" lay-unselect>
                        <input type="text" placeholder="搜索..." autocomplete="off" class="layui-input layui-input-search" layadmin-event="serach" lay-action="template/search.html?keywords=">
                    </li> -->
                </ul>
                <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
                    <!-- 消息 -->
                    <!-- <li class="layui-nav-item" lay-unselect>
                        <a lay-href="app/message/index.html" layadmin-event="message" lay-text="消息中心">
                            <i class="layui-icon layui-icon-notice"></i>

                            <!-- 如果有新消息，则显示小圆点
                            <span class="layui-badge-dot"></span>
                        </a>
                    </li> -->
                    <!-- 调色板 -->
                    <!-- <li class="layui-nav-item layui-hide-xs" lay-unselect>
                        <a href="javascript:;" layadmin-event="theme" id="btn2">
                            <i class="layui-icon layui-icon-theme"></i>
                        </a>
                    </li> -->
                    <!-- 便签 -->
                    <!-- <li class="layui-nav-item layui-hide-xs" lay-unselect>
                        <a href="javascript:;" layadmin-event="note" id="btn1">
                            <i class="layui-icon layui-icon-note"></i>
                        </a>
                    </li> -->
                    <li class="layui-nav-item layui-hide-xs quanping" lay-unselect>
                        <a href="javascript:;" layadmin-event="fullscreen">
                            <i class="layui-icon layui-icon-screen-full"></i>
                        </a>
                    </li>
                    <li class="layui-nav-item" lay-unselect style="text-align: center;">
                        <a href="javascript:;">
                            <cite id="getNameShouYe"></cite>
                        </a>
                        <dl class="layui-nav-child">
                            <dd id="upDataInformation"><a>基本资料</a></dd>
                            <dd id="upDataPassWord"><a>修改信息</a></dd>
                            <hr>
                            <dd id="tuichu" layadmin-event="logout" style="text-align: center;"><a>退出</a></dd>
                        </dl>
                    </li>

                    <li class="layui-nav-item layui-hide-xs" lay-unselect>
                        <a href="javascript:;" layadmin-event="about"><i class="layui-icon layui-icon-more-vertical"></i></a>
                    </li>
                    <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-unselect>
                        <a href="javascript:;" layadmin-event="more"><i class="layui-icon layui-icon-more-vertical"></i></a>
                    </li>
                </ul>
            </div>
            <!-- 页面标签 -->
            <div class="layadmin-pagetabs" id="LAY_app_tabs">
                <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
                <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
                <div class="layui-icon layadmin-tabs-control layui-icon-down">
                    <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
                        <li class="layui-nav-item" lay-unselect>
                            <a href="javascript:;"></a>
                            <!-- <dl class="layui-nav-child layui-anim-fadein">
                                <dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前标签页</a></dd>
                                <dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它标签页</a></dd>
                                <dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭全部标签页</a></dd>
                            </dl> -->
                        </li>
                    </ul>
                </div>
                <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
                    <ul class="layui-tab-title fubiaoqian" id="LAY_app_tabsheader">
                        <li lay-id="./html/shouye/shouye.html" lay-attr="./html/shouye/shouye.html" class="layui-this" onclick="zhidingyemian(event)">
                            <i class="layui-icon layui-icon-home"></i>
                        </li>
                    </ul>
                </div>
            </div>

            <!-- 侧边菜单 -->
            <div class="layui-side layui-side-menu">
                <div class="layui-side-scroll">
                    <div class="layui-logo" lay-href="home/console.html" style="padding-left: 5px;">
                        <span>惠济区村（居）务监督平台</span>
                    </div>
                    <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu">
                        <li data-name="home" lay-tips="主页" class="layui-nav-item layui-nav-itemed layui-this yemian" lay-href="./html/shouye/shouye.html">
                            <a href="javascript:;" lay-tips="主页" lay-direction="2">
                                <i class="layui-icon layui-icon-home"></i>
                                <cite>主页</cite>
                            </a>
                        </li>
                        <li data-name="information" class="layui-nav-item">
                            <a href="javascript:;" lay-tips="组件" lay-direction="2">
                                <i class="layui-icon layui-icon-component"></i>
                                <cite>信息管理</cite>
                            </a>
                            <dl class="layui-nav-child">
                                <dd data-name="button" lay-tips="区信息" class="yemian" lay-href="./html/xinxiguanli/quxinxi.html">
                                    <a>区(县)信息</a>
                                </dd>
                                <dd data-name="button" lay-tips="镇(街道)信息" class="yemian" lay-href="./html/xinxiguanli/zhenjiedaoxinxi.html">
                                    <a>镇(街道)信息</a>
                                </dd>
                                <dd data-name="button" lay-tips="行政村信息" class="yemian" lay-href="./html/xinxiguanli/xingzhengcunxinxi.html">
                                    <a lay-href="component/button/index.html">行政村信息</a>
                                </dd>
                                <dd data-name="button" lay-tips="行政村组信息" class="yemian" lay-href="./html/xinxiguanli/xingzhengcunzuxinxi.html">
                                    <a lay-href="component/button/index.html">行政村组信息</a>
                                </dd>
                                <dd data-name="button" lay-tips="村三委信息" class="yemian" lay-href="./html/xinxiguanli/cunsanwei.html">
                                    <a lay-href="component/button/index.html">村三委信息</a>
                                </dd>
                                <dd data-name="button" lay-tips="用户信息" class="yemian" lay-href="./html/xinxiguanli/yonghuxinxi.html">
                                    <a lay-href="component/button/index.html">用户信息</a>
                                </dd>
                                <dd data-name="button" lay-tips="户口迁移" class="yemian" lay-href="./html/xinxiguanli/hukoqianyi.html">
                                    <a lay-href="component/button/index.html">户口迁移</a>
                                </dd>
                                <dd data-name="grid">
                                    <a href="javascript:;">行政村补助信息</a>
                                    <dl class="layui-nav-child">
                                        <dd data-name="list" lay-tips="补助项类型" class="yemian" lay-href="./html/xinxiguanli/buzhuxiangleixing.html"><a lay-href="component/grid/list.html">补助项类型</a></dd>
                                        <dd data-name="mobile" lay-tips="补助项" class="yemian" lay-href="./html/xinxiguanli/buzhuxiang.html"><a lay-href="component/grid/mobile.html">补助项</a></dd>
                                        <dd data-name="mobile-pc" lay-tips="补助信息" class="yemian" lay-href="./html/xinxiguanli/buzhuxinxi.html"><a lay-href="component/grid/mobile-pc.html">补助信息</a></dd>
                                    </dl>
                                </dd>
                                <dd data-name="button" lay-tips="村干部信息" class="yemian" lay-href="./html/xinxiguanli/cunganbuxinxi.html">
                                    <a>村干部信息</a>
                                </dd>
                                <dd data-name="button" lay-tips="党员发展" class="yemian" lay-href="./html/xinxiguanli/dangyuanfazhan.html">
                                    <a>党员发展</a>
                                </dd>
                            </dl>
                        </li>
                        <li data-name="three-money" class="layui-nav-item">
                            <a href="javascript:;" lay-tips="页面" lay-direction="2">
                                <i class="layui-icon layui-icon-template"></i>
                                <cite>三资管理</cite>
                            </a>
                            <dl class="layui-nav-child">
                                <dd>
                                    <a lay-href="template/personalpage.html">资源</a>
                                    <dl class="layui-nav-child">
                                        <dd data-name="button" lay-tips="资源类型" class="yemian" lay-href="./html/sanziguanli/ziyuanleixing.html">
                                            <a lay-href="app/content/list.html">资源类型</a>
                                        </dd>
                                        <dd data-name="button" lay-tips="资源信息" class="yemian" lay-href="./html/sanziguanli/ziyuanxinxi.html"><a lay-href="app/content/tags.html">资源信息</a></dd>
                                    </dl>
                                </dd>
                                <dd>
                                    <a lay-href="template/addresslist.html">资产</a>
                                    <dl class="layui-nav-child">
                                        <dd data-name="button" lay-tips="资产类型" class="yemian" lay-href="./html/sanziguanli/zichanleixing.html"><a lay-href="app/content/list.html">资产类型</a></dd>
                                        <dd data-name="button" lay-tips="资产信息" class="yemian" lay-href="./html/sanziguanli/zichanxinxi.html"><a lay-href="app/content/tags.html">资产信息</a></dd>
                                    </dl>
                                </dd>
                                <dd data-name="button" lay-tips="资金" class="yemian" lay-href="./html/sanziguanli/zijin.html"><a lay-href="template/caller.html">资金</a></dd>
                                <dd data-name="button" lay-tips="项目建设" class="yemian" lay-href="./html/sanziguanli/xiangmujianshe.html"><a lay-href="">项目建设</a></dd>
                            </dl>
                        </li>
                        <li data-name="announce" class="layui-nav-item">
                            <a href="javascript:;" lay-tips="应用" lay-direction="2">
                                <i class="layui-icon layui-icon-app"></i>
                                <cite>发布管理</cite>
                            </a>
                            <dl class="layui-nav-child">
                                <dd data-name="button" lay-tips="学习园地" class="yemian" lay-href="./html/fabuguanli/learninggarden1.html">
                                    <a lay-href="app/message/index.html">学习园地</a>
                                </dd>
                                <dd data-name="button" lay-tips="村告栏" class="yemian" lay-href="./html/fabuguanli/village bulletin board.html">
                                    <a lay-href="app/workorder/list.html">村告栏</a>
                                </dd>
                                <dd data-name="button" lay-tips="村会议" class="yemian" lay-href="./html/fabuguanli/village meeting.html">
                                    <a lay-href="app/workorder/list.html">村会议</a>
                                </dd>
                                <dd data-name="content">
                                    <a href="javascript:;">村组织活动</a>
                                    <dl class="layui-nav-child">
                                        <dd data-name="button" lay-tips="村组织活动类型" class="yemian" lay-href="./html/fabuguanli/village organization activity type.html"><a>村组织活动类型</a></dd>
                                        <dd data-name="button" lay-tips="村组织活动信息" class="yemian" lay-href="./html/fabuguanli/village organization activity information.html"><a>村组织活动信息</a></dd>
                                    </dl>
                                </dd>
                                <dd data-name="forum">
                                    <a href="javascript:;">党组织活动</a>
                                    <dl class="layui-nav-child">
                                        <dd data-name="button" lay-tips="党组织活动类型" class="yemian" lay-href="./html/fabuguanli/party organization activity type.html"><a>党组织活动类型</a></dd>
                                        <dd data-name="button" lay-tips="党组织活动信息" class="yemian" lay-href="./html/fabuguanli/party organization activity information.html"><a>党组织活动信息</a></dd>
                                    </dl>
                                </dd>
                            </dl>
                        </li>
                        <li data-name="opinions" class="layui-nav-item">
                            <a href="javascript:;" lay-tips="高级" lay-direction="2">
                                <i class="layui-icon layui-icon-senior"></i>
                                <cite>群众意见建议处理</cite>
                            </a>
                            <dl class="layui-nav-child" id="getXiangShangFanKui">
                                <dd data-name="button" lay-tips="未处理意见建议" class="yemian" lay-href="./html/qunzhongyijian/weichuliyijian.html">
                                    <a>未处理意见建议</a>
                                </dd>
                                <dd data-name="button" lay-tips="已处理意见建议" class="yemian" lay-href="./html/qunzhongyijian/yichuliyijian.html">
                                    <a layadmin-event="im">已处理意见建议</a>
                                </dd>
                                <!-- <dd data-name="button" lay-tips="向上级反馈意见建议" class="yemian" lay-href="./html/qunzhongyijian/xiangshangji.html">
                                    <a layadmin-event="im">向上级反馈意见建议</a>
                                </dd> -->
                            </dl>
                        </li>
                        <!-- <li data-name="user" class="layui-nav-item yemian" lay-tips="用户管理" lay-href="./html/user/ad-management.html">
                            <a href="javascript:;" lay-tips="用户管理" lay-direction="2">
                                <i class="layui-icon layui-icon-user"></i>
                                <cite>用户管理</cite>
                            </a>
                        </li>
                        <li data-name="get" class="layui-nav-item yemian" lay-tips="用户日志" lay-href="./html/user/user-log.html">
                            <a href="javascript:;" lay-tips="用户日志" lay-direction="2">
                                <i class="layui-icon layui-icon-auz"></i>
                                <cite>用户日志</cite>
                            </a>
                        </li> -->
                    </ul>
                </div>
            </div>

            <!-- 主体内容 -->
            <div class="layui-body" id="LAY_app_body">
                <div class="layadmin-tabsbody-item layui-show">
                    <iframe id="shouye" src="./html/shouye/shouye.html" height="550px" width="1200px" frameborder="0"></iframe>
                </div>
            </div>

            <!-- 辅助元素，一般用于移动设备下遮罩 -->
            <!-- <div class="layadmin-body-shade" layadmin-event="shade"></div> -->
        </div>
    </div>
</body>
<script src="./layui/layui.js"></script>
<script src="./layui/layui.all.js"></script>
<script src="./js/jquery-3.4.1.js"></script>
<script src="./mock/mock/mock-min.js" type="text/javascript" charset="utf-8"></script>
<script src="./mock/mock1.js" type="text/javascript" charset="utf-8"></script>

<script type="text/javascript">
    // 刷新
    $("#refresh").click(function() {
        location.reload();
    })

    // 获取名字
    $("#getNameShouYe").text(localStorage.getItem('name'));

    // 退出登录
    $("#tuichu").click(function() {
        localStorage.clear();
        window.location.replace("./html/login/index.html");
    })

    // 基本信息
    $("#upDataInformation").click(function() {
        console.log(1111)
        layer.open({
            type: 1,
            title: '查看基本信息' //false不显示标题栏
                ,
            closeBtn: false,
            area: '350px',
            shade: 0.9,
            id: 'formUpdate' //设定一个id, 防止重复弹出
                ,
            btn: ['确定'],
            btnAlign: 'c',
            moveType: 0 //拖拽模, 0或者1, 0可拖拽
                ,
            shade: [0.6, '#393D49'] //遮盖
                ,
            content: `<div style="padding: 20px; line-height: 22px; background-color: #fff; color: #393D49; font-weight: 300;">` +
                `<form class="layui-form" action="">` +
                `<div class="layui-form-item">` +
                `<label class="layui-form-label">管理员姓名</label>` +
                `<div class="layui-input-block">` +
                `<input type="text" name="username" readonly placeholder="` + localStorage.getItem('name') + `"  lay-verify="required" autocomplete="off" class="layui-input">` +
                `</div>` +
                `</div>` +
                `<div class="layui-form-item">` +
                `<label class="layui-form-label">管理员级别</label>` +
                `<div class="layui-input-block">` +
                `<input type="text" name="rank" readonly placeholder="` + jibie(localStorage.getItem('level')) + `" autocomplete="off" class="layui-input">` +
                `</div>` +
                `</div>` +
                `<div class="layui-form-item">` +
                `<label class="layui-form-label">所属级别</label>` +
                `<div class="layui-input-block">` +
                `<input type="text" name="areaRank" id="areaRank" readonly lay-verify="required" autocomplete="off" class="layui-input" style="color: #ccc;">` +
                `</div>` +
                `</div>` +
                `<div class="layui-form-item">` +
                `<label class="layui-form-label">管理员账号</label>` +
                `<div class="layui-input-block">` +
                `<input type="text" name="account" readonly placeholder="` + localStorage.getItem('username') + `" autocomplete="off" class="layui-input">` +
                `</div>` +
                `</div>` +
                `<div class="layui-form-item">` +
                `<label class="layui-form-label">管理员密码</label>` +
                `<div class="layui-input-inline">` +
                `<input type="text" name="password1" readonly placeholder="` + localStorage.getItem('password') + `" autocomplete="off" class="layui-input">` +
                `</div>` +
                `</div>` +
                `</form>` +
                `</div>`,
            success: function() {
                getTownVillageName(localStorage.getItem('townId'), localStorage.getItem('villageId'));
            },
            yes: function(index, layero) { // 第一个按钮的回调函数
                // 关闭窗口
                layer.close(index); //如果设定了yes回调，需进行手工关闭

            }
        });
    })

    // 修改密码
    $("#upDataPassWord").click(function() {
            layer.open({
                type: 1,
                title: '修改密码' //false不显示标题栏
                    ,
                closeBtn: false,
                area: '350px;',
                shade: 0.9,
                id: 'formUpdate' //设定一个id, 防止重复弹出
                    ,
                btn: ['确定', '取消'],
                btnAlign: 'c',
                moveType: 0 //拖拽模, 0或者1, 0可拖拽
                    ,
                shade: [0.6, '#393D49'] //遮盖
                    ,
                content: `<div style="padding: 20px; line-height: 22px; background-color: #fff; color: #393D49; font-weight: 300;">` +
                    `<form class="layui-form" action="" id="formUpData" lay-filter="formUpData">` +
                    `<div class="layui-form-item">` +
                    `<label class="layui-form-label">管理员姓名</label>` +
                    `<div class="layui-input-block">` +
                    `<input type="text" name="username" id="username" required  lay-verify="required" placeholder="请输入管理员姓名" autocomplete="off" class="layui-input">` +
                    `</div>` +
                    `</div>` +
                    `<div class="layui-form-item">` +
                    `<label class="layui-form-label">管理员级别</label>` +
                    `<div class="layui-input-block">` +
                    `<input type="text" name="rank" id="rank" readonly  autocomplete="off" class="layui-input">` +
                    `</div>` +
                    `</div>` +
                    `<div class="layui-form-item">` +
                    `<label class="layui-form-label">所属级别</label>` +
                    `<div class="layui-input-block">` +
                    `<input type="text" name="areaRank" id="areaRank" readonly lay-verify="required" autocomplete="off" class="layui-input">` +
                    `</div>` +
                    `</div>` +
                    `<div class="layui-form-item">` +
                    `<label class="layui-form-label">管理员账号</label>` +
                    `<div class="layui-input-block">` +
                    `<input type="text" name="account" id="account" required  lay-verify="required" placeholder="请输入管理员账号" autocomplete="off" class="layui-input">` +
                    `</div>` +
                    `</div>` +
                    `<div class="layui-form-item">` +
                    `<label class="layui-form-label">管理员密码</label>` +
                    `<div class="layui-input-inline">` +
                    `<input type="text" name="password1" id="password1" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">` +
                    `</div>` +
                    `</div>` +
                    `<div class="layui-form-item">` +
                    `<label class="layui-form-label">确认密码</label>` +
                    `<div class="layui-input-inline">` +
                    `<input type="text" name="password2" id="password2" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">` +
                    `</div>` +
                    `</div>` +
                    `</form>` +
                    `</div>`,
                success: function() {
                    var name = localStorage.getItem('name');
                    var username = localStorage.getItem('username');
                    var password = localStorage.getItem('password');
                    var level = localStorage.getItem('level');
                    var townId = localStorage.getItem('townId');
                    var villageId = localStorage.getItem('villageId');
                    $("#username").val(name);
                    $("#account").val(username);
                    $("#rank").val(jibie(level));
                    $("#password1").val(password);
                    $("#password2").val(password);
                    getLevelUpData(level);
                    // 镇村不可更改时
                    getTownVillageName(townId, villageId);
                },
                yes: function(index, layero) { // 第一个按钮的回调函数
                    var username = $("#username").val();
                    var account = $("#account").val();
                    var password1 = $("#password1").val();
                    var password2 = $("#password2").val();
                    localStorage.setItem('name', username)
                    localStorage.setItem('username', account)
                    localStorage.setItem('password', password1)
                    if ((ceshiname(username) == 1) && (ceshipassword(password1, password2) == 1)) {
                        if (password1 !== "") {
                            // 向服务端发送编辑指令
                            var data = new Array();
                            data[0] = username;
                            data[1] = account;
                            data[2] = password1;
                            console.log(data);
                            url0 = url + "/user/edituser?id=" + parseInt(localStorage.getItem('id')) + "&areaId=1349&init=1&level=" + localStorage.getItem('level') + "&name=" + data[0] + "&password=" + data[2] + "&username=" + data[1];
                            console.log(url0);
                            $.ajax({
                                url: url0,
                                type: "post",
                                success: function(data) {
                                    layer.msg(data.msg);
                                    console.log("编辑管理员成功");
                                },
                            });
                            // 关闭窗口
                            layer.close(index); //如果设定了yes回调，需进行手工关闭
                        } else {
                            layer.msg('密码不能为空')
                        }

                    }
                }
            });
        })
        // 查看获取镇/村名字--开始
    function getTownVillageName(townId, villageId) {
        console.log(townId);
        console.log(villageId);
        var getTownNameById;
        var getVillageNameById;
        var preVillageId = villageId;
        if (townId == "" || townId == null || townId == "null") { // 区级
            $("#areaRank").val("惠济区");
            $("#areaRank").css("opacity", "0.8");
        } else if (villageId == "" || villageId == null || villageId == "null") { // 镇级
            $.ajax({
                url: url + '/town/getonebyid?id=' + townId,
                type: "get",
                success: function(data) {
                    console.log(data);
                    getTownNameById = data.data.name;
                    $("#areaRank").val(getTownNameById);
                    $("#areaRank").css("opacity", "0.8");
                }
            });
        } else { // 村级
            $.ajax({
                url: url + '/town/getonebyid?id=' + townId,
                type: "get",
                success: function(data) {
                    console.log(data);
                    getTownNameById = data.data.name;
                    console.log(getTownNameById);
                    $.ajax({
                        url: url + '/village/getonebyid?id=' + preVillageId,
                        type: "get",
                        success: function(data) {
                            console.log(data);
                            getVillageNameById = data.data.name;
                            // console.log(getVillageNameById);
                            $("#areaRank").val(getTownNameById + "/" + getVillageNameById);
                            $("#areaRank").css("opacity", "0.8");
                        }
                    });
                }
            });
        }
        // 查看获取镇/村名字--结束
    }
    // 获取级别
    function getLevelUpData(id) {
        layui.use(['form'], function() {
            var form = layui.form //表单
            $("#rank").find("option[value=" + id + "]").prop("selected", true);
            form.render();
        })
    }
    // 级别开始
    function jibie(num) {
        if (num == 0) {
            return "市级管理员"
        }
        if (num == 1) {
            return "区级管理员"
        } else if (num == 2) {
            return "镇级管理员"
        } else if (num == 3) {
            return "村级管理员"
        }
    }
    // 级别结束
    // 判断
    function ceshiname(name) { //验证姓名是否符合规范
        if (!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(name)) {
            alert('用户名不能有特殊字符');
            return 0;
        } else if (/(^\_)|(\__)|(\_+$)/.test(name)) {
            alert('用户名首尾不能出现下划线\'_\'');
            return 0;
        } else if (/^\d+\d+\d$/.test(name)) {
            alert('用户名不能全为数字');
            return 0;
        }
        return 1;
    }

    function ceshiaccount(account) { //验证手机号是否符合规范
        if (!(/^1[3456789]\d{9}$/.test(account))) {
            alert("手机号码有误，请重填");
            return 0;
        }
        return 1;
    }

    function ceshipassword(password1, password2) { //验证两次密码是否相同
        if (password1 != password2) {
            alert("两次密码输入的不一致");
            return 0;
        }
        return 1;
    }
</script>
<script type="text/javascript">
    function getUser() {
        $(`<li data-name="user" lay-tips="用户管理" class="layui-nav-item yemian" lay-href="./html/user/ad-management.html">` +
            `<a href="javascript:;" lay-tips="用户管理"  lay-direction="2">` +
            `<i class="layui-icon layui-icon-user"></i>` +
            `<cite>用户管理</cite>` +
            `</a>` +
            `</li>`).appendTo("#LAY-system-side-menu");
    }

    function getGet() {
        $(`<li data-name="get" lay-tips="用户日志" class="layui-nav-item yemian" lay-href="./html/user/user-log.html">` +
            `<a href="javascript:;" lay-tips="用户日志" lay-direction="2">` +
            `<i class="layui-icon layui-icon-auz"></i>` +
            `<cite>用户日志</cite>` +
            `</a>` +
            `</li>`).appendTo("#LAY-system-side-menu");
    }


    function getXiangShangFanKui() {
        $(`<dd data-name="button" lay-tips="向上级反馈意见建议" class="yemian" lay-href="./html/qunzhongyijian/xiangshangji.html">` +
            `<a layadmin-event="im">向上级反馈意见建议</a>` +
            `</dd>`).appendTo("#getXiangShangFanKui");
    }
    $(document).ready(function() {
        var jibie;
        console.log(localStorage.getItem('level'));
        jibie = localStorage.getItem('level');
        if (jibie == 0) {
            layer.msg("市级管理员你好！");
            getUser();
            getGet();
        }
        if (jibie == 1) {
            layer.msg("区级管理员你好！");
            getUser();
            getGet();
        } else if (jibie == 2) {
            layer.msg("镇级管理员你好！")
            getUser();
            getGet();
            getXiangShangFanKui();
        } else if (jibie == 3) {
            layer.msg("村级管理员你好！")
            getGet();
            getXiangShangFanKui();
        }
    })
</script>
<script>
    layui.config({
        base: './layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use('index');
</script>

<!-- 百度统计 -->
<script>
    var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?d214947968792b839fd669a4decaaffc";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>

<script>
    layui.data.theme = function() {
        layui.use('form', function() {
            var form = layui.form,
                admin = layui.admin;

            //监听隐藏开关
            form.on('switch(system-theme-sideicon)', function() {
                admin.theme({
                    hideSideIcon: this.checked
                })
            });
        });
    };
</script>
</div><span class="layui-layer-setwin"></span><span class="layui-layer-resize"></span></div> -->
<!-- 左边导航栏收缩的方法 -->
<script type="text/javascript">
    $('.shousuo ').on('click', function() {
        $('.layui-icon-shrink-right').toggleClass('layui-icon-spread-left');
        $('.me').toggleClass('layadmin-side-shrink');

    })
</script>

<script>
    // layui.use('layer', function() {
    //     var layer = layui.layer;

    //     var btn = document.getElementById('btn1');
    //     btn.onclick = function() {
    //         layer.open({
    //             type: 1,
    //             title: '便签', //
    //             skin: 'layui-anim layui-anim-upbit', //加上边框
    //             offset: ['52px', '1070px'], //便签位置
    //             area: ['280px', '150px'], //宽高
    //             shade: 0,
    //             id: 'layadmin-layer-skin-test',
    //             content: '便签中的内容会存储在本地，这样即便你关掉了浏览器，在下次打开时，依然会读取到上一次的记录。是个非常小巧实用的本地备忘录'
    //         });
    //     };

    // })

    // layui.use('layer', function() {
    //     var layer = layui.layer;

    //     var btn = document.getElementById('btn2');
    //     btn.onclick = function() {
    //         layer.open({
    //             type: 1,
    //             title: '配色方案', //
    //             skin: 'layui-anim layui-anim-upbit', //加上边框
    //             offset: ['60px', '1180px'], //便签位置
    //             area: ['373px', '840px'], //宽高
    //             shade: 0,
    //             id: 'layadmin-layer-skin-test',
    //             content: 'uijbnjk'

    //         });
    //     };

    // })
</script>
<!-- // 全屏的方法 -->
<script type="text/javascript">
    $('.quanping').on('click', function() {
        var docElm = document.documentElement;
        if (docElm.requestFullscreen) {
            docElm.requestFullscreen();
        } else if (docElm.mozRequestFullScreen) {
            docElm.mozRequestFullScreen();
        } else if (docElm.webkitRequestFullScreen) {
            docElm.webkitRequestFullScreen();
        } else if (elem.msRequestFullscreen) {
            elem.msRequestFullscreen();
        }
        if (document.exitFullscreen) {
            document.exitFullscreen();
        } else if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen();
        } else if (document.webkitCancelFullScreen) {
            document.webkitCancelFullScreen();
        } else if (document.msExitFullscreen) {
            document.msExitFullscreen();
        }
    })
</script>
<!-- 切换页面的实现方法 -->
<script>
    $(document).ready(function() {
        $('.yemian').on('click', function() { //对添加页面进行监听    
            var that = this
            var cunzai = false;
            $.each($('.fubiaoqian')[0].children, function(index, item) { // 头部的一排
                if (item.attributes[1].nodeValue == $(that)[0].attributes[3].nodeValue) {
                    cunzai = true // 该页面是否打开
                }
            })
            if (cunzai) { //点击侧边栏   如果是已经打开了的页面   展示
                $('#shouye').attr('src', './html/shouye/shouye.html'); // 刷新首页用的

                for (var i = 0; i < $('.fubiaoqian').children().length; i++) { // 如果是已经打开的页面，不用在上面添加
                    if ($(this)[0].attributes[3].nodeValue == $('.fubiaoqian').children()[i].attributes[1].nodeValue) {
                        $('.layui-this').each(function() {
                            $(this).removeClass('layui-this')
                        })
                        $('.fubiaoqian').children()[i].classList.add('layui-this')

                        $('.layui-show').each(function() {
                            $(this).removeClass('layui-show')
                        })
                        $('.layui-body').children()[i].classList.add('layui-show')
                    }
                }
            } else { // 页面还没有打开   添加新元素(顶部和底部)(顶部要设置为layui-this)
                // 顶部部分--开始
                // 先移除当前顶部的样式，在进行下一个  显示（移除layui-this，移除了左边侧边栏和右边上面的所有的颜色）
                $('.layui-this').each(function() {
                        $(this).removeClass('layui-this')
                    })
                    // 继续添加新的一个顶部
                $('.fubiaoqian')[0].innerHTML += '<li lay-id="' + $(this)[0].attributes[3].nodeValue + '" lay-attr="' + $(this)[0].attributes[3].nodeValue + '" class="layui-this" onclick="zhidingyemian(event)">' + $(this)[0].attributes[1].nodeValue + '<i class="layui-icon layui-unselect layui-tab-close" onclick="guanbi(event)">ဆ</i></li>';
                // 顶部部分--结束

                // 主题内容--开始
                // 先移除右边主体内容
                $('.layui-show').each(function() {
                        $(this).removeClass('layui-show')
                    })
                    // 继续添加一个新的主体内容
                $('.layui-body')[0].innerHTML += '<div class="layadmin-tabsbody-item layui-show"><iframe src="' + $(this)[0].attributes[3].nodeValue + '" frameborder="0"></iframe></div>';
                // 主题内容--结束

                // 样式变色--开始
                // 所有颜色取消----上面753行已实现（移除layui-this，移除了左边侧边栏和右边上面的所有的颜色）
                // $('.layui-this').each(function() {
                //     $(this).removeClass('layui-this')
                // })
                // 新的页面变色
                $(that).addClass('layui-this');
                // 样式变色--结束
            }

        })
    })

    function guanbi(event) { //这是关闭那个页面的方法   参数是在父结点中是第几个
        for (var i = 0; i < $('.fubiaoqian').children().length; i++) {
            if ($(event.target).parent()[0].attributes[1].nodeValue == $('.fubiaoqian').children()[i].attributes[1].nodeValue) {
                $('.fubiaoqian').children()[i].remove()
                $('.layui-this').each(function() {
                    $(this).removeClass('layui-this')
                })
                $('.fubiaoqian').children()[i - 1].classList.add('layui-this')
                $('.layui-body').children()[i].remove()
                $('.layui-show').each(function() {
                    $(this).removeClass('layui-show')
                })
                $('.layui-body').children()[i - 1].classList.add('layui-show')
            }
        }
    }

    function zhidingyemian(event) { //点击页面可以显示指定的页面
        $('#shouye').attr('src', './html/shouye/shouye.html');
        for (var i = 0; i < $('.fubiaoqian').children().length; i++) {

            // 点击顶部（除首页以外）
            if ($(event.target)[0].attributes[1]) {
                console.log("11111")
                    // 切换顶部
                if ($(event.target)[0].attributes[1].nodeValue == $('.fubiaoqian').children()[i].attributes[1].nodeValue) {
                    console.log("222222")
                    $('.layui-this').each(function() {
                        $(this).removeClass('layui-this')
                    })

                    $('.fubiaoqian').children()[i].classList.add('layui-this')

                    $('.layui-show').each(function() {
                        $(this).removeClass('layui-show')
                    })
                    $('.layui-body').children()[i].classList.add('layui-show')
                }

                //点击顶部的首页
            } else if ($(event.target).parent()[0].attributes[1].nodeValue == $('.fubiaoqian').children()[i].attributes[1].nodeValue) {
                console.log("333333")
                $('.layui-this').each(function() {
                    $(this).removeClass('layui-this')
                })
                $('.fubiaoqian').children()[i].classList.add('layui-this')

                $('.layui-show').each(function() {
                    $(this).removeClass('layui-show')
                })
                $('.layui-body').children()[i].classList.add('layui-show')
            }

        }
    }
</script>



<script>
    chushihua()
    var areas = [];
    var towns = [];
    var villages = [];
    var groups = [];

    function chushihua() {
        if (localStorage.getItem('level') == "0") {
            huoqucz0()
        }
        if (localStorage.getItem('level') == "1") {
            // 区管理员
            huoqucz1()
        } else if (localStorage.getItem('level') == "2") {
            // 镇管理员
            huoqucz2()
        } else if (localStorage.getItem('level') == "3") {
            // 村管理员
            huoqucz3()
        }
    }
    // 获取所有村  所有镇   所有区信息  存本地
    function huoqucz0() {
        $.ajax({
            url: url + "area/queryarea",
            method: "get",
            success: function(data) {
                console.log(data)
                areas = data.data.areas
            },
            error: function(err) {}
        })
        $.ajax({
            url: url + "town/querytown",
            method: "get",
            data: "",
            success: function(data) {
                console.log(data)
                towns = data.data.towns
            },
            error: function(err) {}
        })
        $.ajax({
                url: url + "village/queryvillage",
                method: "get",
                data: {
                    currrntPage: 1,
                    size: 1000000
                },
                success: function(data) {
                    console.log(data)
                    villages = data.data.villages
                },
                error: function(err) {}
            })
            // 获取所有的组
        $.ajax({
            url: url + "group/queryAllGroup",
            method: "get",
            data: "",
            success: function(data) {
                console.log(data)
                groups = data.data
            },
            error: function(err) {}
        })

    }
    // 获取所有村  所有镇信息   存本地 
    function huoqucz1() {

        $.ajax({
            url: url + "area/getonebyid",
            method: "get",
            data: {
                id: localStorage.getItem('areaId')
            },
            success: function(data) {
                console.log(11)
                console.log(data)
                areas.push(data.data)
                console.log(areas)
            },
            error: function(err) {}
        })

        $.ajax({
            url: url + "town/querytown",
            method: "get",
            data: "",
            success: function(data) {
                console.log(data)
                towns = data.data.towns
            },
            error: function(err) {}
        })
        $.ajax({
                url: url + "village/queryvillage",
                method: "get",
                data: {
                    currrntPage: 1,
                    size: 1000000
                },
                success: function(data) {
                    console.log(data)
                    villages = data.data.villages
                },
                error: function(err) {}
            })
            // 获取所有的组
        $.ajax({
            url: url + "group/queryAllGroup",
            method: "get",
            data: "",
            success: function(data) {
                console.log(data)
                groups = data.data
            },
            error: function(err) {}
        })

    }


    // 获取 镇信息  镇下所有村信息    存本地
    function huoqucz2() {
        $.ajax({
            url: url + "area/getonebyid",
            method: "get",
            data: {
                id: localStorage.getItem('areaId')
            },
            success: function(data) {
                console.log(data)
                areas.push(data.data)
            },
            error: function(err) {}
        })

        $.ajax({
            url: url + "town/getonebyid",
            method: "get",
            data: {
                id: localStorage.getItem('townId')
            },
            success: function(data) {
                console.log(data)
                var data1 = []
                data1.push(data.data)
                towns = data1
            },
            error: function(err) {}
        })
        $.ajax({
                url: url + "village/queryvillage",
                method: "get",
                data: {
                    currrntPage: 1,
                    size: 1000000,
                    townId: localStorage.getItem("townId")
                },
                success: function(data) {
                    console.log(data)
                    villages = data.data.villages
                },
                error: function(err) {}
            })
            // 获取所有的组
        $.ajax({
            url: url + "group/queryAllGroup",
            method: "get",
            data: "",
            success: function(data) {
                console.log(data)
                groups = data.data
            },
            error: function(err) {}
        })
    }


    // 获取镇信息 村信息    存本地   
    function huoqucz3() {
        $.ajax({
            url: url + "area/getonebyid",
            method: "get",
            data: {
                id: localStorage.getItem('areaId')
            },
            success: function(data) {
                console.log(data)
                areas.push(data.data)
            },
            error: function(err) {}
        })

        $.ajax({
            url: url + "town/getonebyid",
            method: "get",
            data: {
                id: localStorage.getItem('townId')
            },
            success: function(data) {
                console.log(data)
                var data1 = []
                data1.push(data.data)
                localStorage.setItem('towns', JSON.stringify(data1))
            },
            error: function(err) {}
        })
        $.ajax({
                url: url + "village/getonebyid",
                method: "get",
                data: {
                    id: localStorage.getItem('villageId')
                },
                success: function(data) {
                    console.log(data)
                    var data1 = []
                    data1.push(data.data)
                    localStorage.setItem('villages', JSON.stringify(data1))

                },
                error: function(err) {}
            })
            // 获取所有的组
        $.ajax({
            url: url + "group/queryAllGroup",
            method: "get",
            data: "",
            success: function(data) {
                console.log(data)
                groups = data.data
            },
            error: function(err) {}
        })
    }

    function huowuzhi() {
        a = {}
        a.areas = areas;
        a.towns = towns;
        a.villages = villages;
        a.groups = groups
        return a
    }
</script>

</html>